{% extends 'layout.html' %}

{% load my_tags %}

{% block content %}
    <form action="" method="post">

        {% csrf_token %}

        {{ formset_obj.management_form }}


        <div>
            <button class="btn btn-primary btn-sm">保存</button>
        </div>

        {#    <form action="" method="post" class="form-inline">#}
        {#        {% csrf_token %}#}
        {##}
        {#        <select name="action" class="form-control">#}
        {##}
        {#            <option value="multi_init">批量初始化学习记录</option>#}
        {##}
        {#        </select>#}
        {#        <button class="btn btn-success btn-sm">提交</button>#}

        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>序号</th>
                <th>学生姓名</th>
                <th>考勤</th>
                <th>成绩</th>
                <th>批语</th>

            </tr>
            </thead>
            <tbody>

            {#            {{ formset_obj }}#}

            {% for field in formset_obj %}
                <tr>
                    {{ field.id }}
                    <td>{{ forloop.counter }}</td>
                    <td>{{ field.instance.student }}</td>
                    <td>{{ field.attendance }}</td>
                    <td>{{ field.score }}</td>
                    <td>{{ field.homework_note }}</td>
                    <td class="hidden">{{ field.course_record }}</td>
                    <td class="hidden">{{ field.student }}</td>

                </tr>
            {% endfor %}
            {#            {{ formset_obj.errors }} #}

            </tbody>
        </table>
    </form>
    {#    </form>#}
    <nav aria-label="Page navigation">
        <ul class="pagination">

            {{ page_html }}
        </ul>
    </nav>


{% endblock %}